import os
import json
from run import run
import pandas as pd
config = {
    "project_name": "architecture-ensemble",
    "train_name": "",
    "group_name": "A",
    "architecture": "",
    "inputs_fold": "",
    "output_path": "",
    "max_len": 128,
    "lr": 3e-5,
    "epochs": 15,
    "batch_size": 16,
    "monitor": "val_loss",
    "patience": 10,
    "mode": "min",
    "steps_per_epoch": 200,
    "drop_rate": 0.1,
    "regularizer": 0,
    "is_combain": False,
    "save_model": False,
    "k_fold_num": 5
}

prefix = "/content/drive/MyDrive/lab-result-1/groups"
architecture_list = [

    "junnyu/roformer_chinese_char_base",
    "junnyu/roformer_chinese_base",
    "hfl/chinese-electra-180g-base-discriminator",
    "hfl/chinese-roberta-wwm-ext",
    "hfl/chinese-bert-wwm-ext",
    "bert-base-chinese",
    "yechen/bert-base-chinese",
    "junnyu/bert_chinese_mc_base",
    "junnyu/wobert_chinese_plus_base",
    "hfl/chinese-bert-wwm",
    "hfl/chinese-macbert-base",
    "junnyu/wobert_chinese_base"
]
fold_num = "3"

for architecture in architecture_list:

    config["train_name"] = architecture+"_"+fold_num
    config["architecture"] = architecture

    config["inputs_fold"] = f"/content/drive/MyDrive/ccks2021-wws/lab/data/5fold/fold_"+fold_num

    path = os.path.join(prefix, config["group_name"], config["train_name"])
    config["output_path"] = os.path.join(path, "outputs")
    config_path = os.path.join(path, "config.json")
    if not os.path.exists(path):
        os.makedirs(config["output_path"])
    json.dump(config, open(os.path.join(path, "config.json"), mode="w"))
    run(config_path)
